# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-unicode-display_width
_gemname=unicode-display_width
# NOTE: Before bumping, check version required by jekyll.
pkgver=1.7.0
pkgrel=2
pkgdesc="Monospace Unicode character width in Ruby"
url="https://github.com/janlelis/unicode-display_width"
arch="noarch"
license="MIT"
depends="ruby"
checkdepends="ruby-rspec"
source="https://github.com/janlelis/unicode-display_width/archive/v$pkgver/$_gemname-$pkgver.tar.gz
	tests-skip-emoji.patch
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

build() {
	gem build $_gemname.gemspec
}

check() {
	rspec .
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and rubbish...
	cd "$gemdir"
	rm -r cache build_info doc extensions
}

sha512sums="
2b6d2b0118f4a2ad69e98fe2fac611ca94adc0dc59ad076083d0243c630a81a01d650965149a25feaf8986c262a5d55294e064361420e2140b53c5ced5fb1c77  unicode-display_width-1.7.0.tar.gz
b531e8db6c34b7c191b77251b2bb6b344ae0c6c0a5d9f6b738b042ca769fa1b1bfa639b3e5bc590a83fcf763c9adbb3c39eda8fc0bd8bd0c0e5330f305deb4fc  tests-skip-emoji.patch
95a5769602c1f06e76c73896367db972fea2cb5bbeb8ddcf70e12097563f6651f52eb1ab2482cea69c16fab03bfc71bf5dc33481dfd8974d5f725a19b8519c45  gemspec.patch
"
